package fileCreate;

import java.io.File;
import java.io.IOException;

public class UserFile {
    private String pathName;

    public UserFile(String pathName) {
        this.pathName = pathName;
    }

    public String getPath() {
        return pathName;
    }

    public void createFile(){
        File file = new File(pathName);
        try{
            if(file.createNewFile()){
                System.out.println("文件创建成功:"+pathName);
            }else{
                //System.out.println("文件已存在:"+pathName); //不用打印了
            }
        }catch(IOException e){
            System.out.println("文件创建时出错:"+e.getMessage());
        }
        }
}